import request from "@/utils/request";

/**
 * 设备基本信息api接口集合
 * @method getTechnologyList 查询工艺规程
 * @method getProductList 查询产品型号
 * @method getProductionAdd  新增计划
 * @method postList  计划列表
 * @method delDeleteById  删除计划
 * @method putWorkOrder  计划调整
 * @method getWorkOrderTarget  加工目标
 * @method postWorkOrderTargetById  添加加工目标
 * @method putWorkOrderTargetById  替换加工目标
 * @method delWorkOrderTargetById  删除加工目标
 * @method getWorkOrderTarget  计划调整列表
 * @method getListReplace 获取可替换的规程信息
 * @method postTransferPlan 入库
 */

export function getTechnologyList(params) {
    return request({
        url: "/mpm/processSpecificationController/list",
        method: "post",
        data: params,
    });
}
export function getListReplace(params) {
    return request({
        url: "/mpm/processSpecificationController/listReplace",
        method: "post",
        data: params,
    });
}
export function getProductList(params) {
    return request({
        url: "/mpm/processSpecificationController/listProduct",
        method: "post",
        data: params,
    });
}

export function getProductionAdd(params) {
    return request({
        url: "/mes/mesWorkOrderController/addByModel",
        method: "post",
        data: params,
    });
}
// 计划型号和产品名称手动输入的新增
export function getProductionsAdd(params) {
    return request({
        url: "/mes/mesWorkOrderController/addFinishOrder",
        method: "post",
        data: params,
    });
}
export function postList(params) {
    return request({
        url: "/mes/mesWorkOrderController/listHasCompleteCount",
        method: "get",
        params,
    });
}
export function delDeleteById(id) {
    return request({
        url: "/mes/mesWorkOrderController/" + id,
        method: "delete",
    });
}
export function putWorkOrder(params) {
    return request({
        url: "/mes/mesWorkOrderController/changeDate",
        method: "post",
        data: params,
    });
}
export function getWorkOrderTarget(params) {
    return request({
        url: "/mes/workOrderTargetController/list",
        method: "get",
        params,
    });
}
export function postWorkOrderTargetById(params) {
    return request({
        url: "/mes/mesWorkOrderController/linkProcessRev",
        method: "post",
        data: params,
    });
}
export function putWorkOrderTargetById(params) {
    return request({
        url: "/mes/mesWorkOrderController/replaceProcess",
        method: "post",
        data: params,
    });
}
export function delWorkOrderTargetById(params) {
    return request({
        url: "/mes/mesWorkOrderController/linkProcessRev",
        method: "post",
        data: params,
    });
}
export function postTransferPlan(params) {
    return request({
        url: "/mes/mesWorkOrderController/transferPlan",
        method: "post",
        data: params,
    });
}

export function listChangeHis(id) {
    return request({
        url:
            "/mes/workOrderChangeHisController/list?workOrderId=" +
            id +
            "&orderBy=changeDateTime&orderMethod=desc",
        method: "get",
    });
}
export function batchEditProduct(params) {
    return request({
        url: "/mes/mesWorkOrderController/batchEditProduct",
        method: "post",
        data: params,
    });
}


export function getModelName(params) {
    return request({
        url: "/mpm/processSpecificationController/listModel",
        method: "get",
        params,
    });
}

export  function postCancle(data){
    return request({
        url: "/mes/workOrderTargetController/obsolete",
        method: "post",
        data: data,
    });
}
export function listForProgress(params) {
    return request({
        url: "/mes/mesWorkOrderController/listForProgress",
        method: "post",
        data: params,
    });
}


export function setAssigner(params) {
    return request({
        url: "/mes/mesWorkOrderController/addOrEditAssigner",
        method: "post",
        data: params,
    });
}

export function listSameModelName(params) {
    return request({
        url: "/mes/mesWorkOrderController/listSameModelName",
        method: "get",
        params,
    });
}

export function replaceCode(data) {
    return request({
        url: "/mes/mesWorkOrderController/replaceCode",
        method: "post",
        data: data,
    });
}

export function forcedFinish(data){
    return request({
        url: "/mes/mesWorkOrderController/forcedFinish",
        method: "post",
        data: data,
    });
}

// 根据业务数据查询其附件接口（多选调整）
export function adjustListFiles(params){
    return request({
        url: "/mes/fileController/listFiles",
        method: "get",
        params
    });
}

// 修改erp名称
export function editPlanName(params){
    return request({
        url: "/mes/mesWorkOrderController/edit",
        method: "put",
        data:params
    });
}
// 配套机型
export function targetModelReferGrid(params){
    return request({
        url: "/mes/mesApplyProductController/referGrid",
        method: "post",
        data:params
    });
}
